let $conf = require('../../conf/commonConf');
let baseUrl=$conf.baseUrlJs;
let ajaxRequest=function(reqesturl,requestdata){
  let dtd=$.Deferred();
  $.ajax({
            type: 'POST',
            url: reqesturl,
            data: JSON.stringify(requestdata),
            contentType: "application/json;charset=utf-8",
            dataType: "json"
    }).done(function(result){
  		dtd.resolve(result);
    }).fail(function(err){
  		dtd.reject();
  		console.log(err);
    });
    return dtd.promise();
};
let ajaxRequestGet=function(reqesturl,requestdata){
  let dtd=$.Deferred();
  $.ajax({
        type: 'GET',
            url: reqesturl,
            data: requestdata,
            dataType: "json"
    }).done(function(result){
        dtd.resolve(result);
    }).fail(function(err){
        dtd.reject();
        console.log(err);
    });
    return dtd.promise();
}
module.exports = {
    queryPersonnalData:function(requestdata){
      let queryurl=baseUrl+'queryPersonnalData';
      return ajaxRequest(queryurl,requestdata);
    },
    queryDangersAlertData:function(requestdata){
      let queryurl=baseUrl+'queryDangersAlertData';
      return ajaxRequest(queryurl,requestdata);
    }
};